# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=cgreen
pkgver=1.6.3
pkgrel=0
pkgdesc="A modern, portable, cross-language unit testing and mocking framework for C and C++"
url="https://github.com/cgreen-devs/cgreen"
arch="all"
license="ISC"
makedepends="cmake libxml2-dev samurai"
checkdepends="bash binutils-dev perl diffutils findutils"
subpackages="$pkgname-bash-completion $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/cgreen-devs/cgreen/archive/refs/tags/$pkgver.tar.gz
remove-git-check.patch
cmake-fortify-headers.patch
remove-failing-tests.patch"

prepare() {
	default_prepare
	mkdir -p build
}

build() {
	#export GIT_CEILING_DIRECTORIES="${PWD}"
	cmake -S . -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX:PATH="/usr" \
		-DCGREEN_WITH_LIBXML2=ON \
		-DCGREEN_WITH_UNIT_TESTS=ON \
		-DCGREEN_WITH_XML=ON \
		-DCGREEN_WITH_STATIC_LIBRARY=OFF
	cmake --build build
}

check() {
	cmake --build build --target test
}
package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
0dbd637e6d2c0511d5e540107b3a4c7c66c3017e1626e19224e2e79f176f07a518be345689fc543f867dd0b412310f3bf10f4560de11239120bc206a1be3a3d8  cgreen-1.6.3.tar.gz
7d7d88560f5a5712a2a0c7becd25b009c0ea8ee650b44c95be2e21247b55bcba0e577dd6e0326b08dd1b888502bcd00117d3730584265518573c227cc62b2b22  remove-git-check.patch
2eb03df5064ed84a2b6755e62d3b6ca8911f3521ad4621ff1b7f04e6f2483d846d6310b17bdc524290f79c72b412a9a6d691288bc5b6b23654e7196fce4c0e30  cmake-fortify-headers.patch
1677aba2a2af79d6c6c4fe22bcf31568ae699347bdf2b464dde56b1bc0582f665fbecc8ca9a0ddf328dd8eac454a9a07e8669e3c255b3b030ca3032403be00cd  remove-failing-tests.patch
"
